package com.cakemallproject.mapper;

import com.cakemallproject.pojo.mapperObj.Type;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface TypeMapper {
    @Select("select * from type where status != 0 and tid = #{tid}")
    Type getById(Integer tid);

    @Insert("insert type(name) values(#{name}) ")
    void insert(Type type);

    void delete(List<Integer> ids);

    @Update("update type set name = #{name},update_time = now() where status != 0 and tid = #{tid}")
    void update(Type type);

    @Select("select * from type where status != 0")
    List<Type> list();
}
